from typing import Annotated

from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession

from app.core import dependencies
from app.db import session
from app.db.models import user as user_model
from app.schemas import user as user_schema
# from app.services import user as user_service # For more complex updates

router = APIRouter(prefix="/users", tags=["Users"])

@router.get("/me", response_model=user_schema.User)
async def read_users_me(
    current_user: Annotated[user_model.User, Depends(dependencies.get_current_user)]
):
    """Fetch the current logged-in user's information."""
    return current_user

# TODO: Add endpoint for user to update their own info (e.g., email, password)
# This would typically involve a UserUpdate schema and a service function.
# Example:
# @router.put("/me", response_model=user_schema.User)
# async def update_user_me(
#     user_update: user_schema.UserUpdate,
#     current_user: Annotated[user_model.User, Depends(dependencies.get_current_user)],
#     db: Annotated[AsyncSession, Depends(session.get_db)]
# ):
#     # updated_user = await user_service.update_user(db, user_db=current_user, user_in=user_update)
#     # return updated_user
#     raise HTTPException(status_code=status.HTTP_501_NOT_IMPLEMENTED)
